package mortal.game.view.common.tooltip
{
	import flash.display.*;
	import mortal.game.model.*;
	import mortal.game.resource.info.*;
	import com.mui.manager.*;
	
	public class Tooltip extends Sprite implements IToolTip
	{
		public var tooTip1:NormalTooltip;
		public var tooTip2:NormalTooltip;
		public static const ToolTipRenderType_Text:String = NormalTooltip.ToolTipRenderType_Text;
		public static const ToolTipRenderType_Equipment:String = NormalTooltip.ToolTipRenderType_Equipment;
		public static const ToolTipRenderType_Item:String = NormalTooltip.ToolTipRenderType_Item;
		public static const ToolTipRenderType_Skill:String = NormalTooltip.ToolTipRenderType_Skill;
		public static const ToolTipRenderType_ShortcutItem:String = NormalTooltip.ToolTipRenderType_ShortcutItem;
		public static const ToolTipRenderType_Mounts:String = NormalTooltip.ToolTipRenderType_Mounts;
		
		public function Tooltip()
		{
			this.init();
			
		}
		
		private function init() : void
		{
			this.tooTip1 = new NormalTooltip();
			this.tooTip2 = new NormalTooltip();
			
		}
		
		public function set data(param1:*) : void
		{
			var _loc_2:* = undefined;
			var _loc_3:* = undefined;
			var _loc_4:ToolTipInfo = null;
			var _loc_5:EquipmentToolTipData = null;
			var _loc_6:ItemData = null;
			var _loc_7:EquipmentToolTipData = null;
			var _loc_8:ToolTipInfo = null;
			this.clear();
			if (param1 is ToolTipInfo && param1.type == NormalTooltip.ToolTipRenderType_Equipment)
			{
				_loc_4 = param1 as ToolTipInfo;
				_loc_5 = _loc_4.tooltipData as EquipmentToolTipData;
				if (_loc_5.isContrast)
				{
					_loc_6 = _loc_5.getSameDressingOn();
					if (_loc_6)
					{
						_loc_7 = new EquipmentToolTipData(_loc_6, _loc_5.equipmentsOnPlayer);
						_loc_7.isContrast = false;
						_loc_7.isShowEquipped = true;
						_loc_8 = new ToolTipInfo(NormalTooltip.ToolTipRenderType_Equipment, _loc_7);
						_loc_2 = _loc_8;
						_loc_3 = param1;
					}
					else
					{
						_loc_5.isContrast = false;
						_loc_2 = param1;
					}
				}
				else
				{
					_loc_2 = param1;
				}
			}
			else
			{
				_loc_2 = param1;
			}
			if (_loc_2)
			{
				this.tooTip1.data = _loc_2;
				this.addChild(this.tooTip1);
			}
			if (_loc_3)
			{
				this.tooTip2.data = _loc_3;
				this.addChild(this.tooTip2);
				this.tooTip1.x = this.tooTip2.x + this.tooTip2.width + 5;
				this.tooTip1.y = this.tooTip2.y;
			}
			else
			{
				this.tooTip1.x = 0;
				this.tooTip1.y = 0;
			}
			
		}
		
		private function clear() : void
		{
			if (this.tooTip1.parent)
			{
				this.tooTip1.parent.removeChild(this.tooTip1);
			}
			if (this.tooTip2.parent)
			{
				this.tooTip2.parent.removeChild(this.tooTip2);
			}
			
		}
		
		private function updatePos() : void
		{
			
		}
		
		public function dispose() : void
		{
			//this.tooTip1.dispose();
			//this.tooTip2.dispose();
			
		}
		
	}
}
